package com.ltb.speedlottery.utils;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.support.v4.app.NotificationCompat;

import com.ltb.speedlottery.R;

/**
 * 类描述：
 * <p>
 * 作者：TB.Liu on 18-10-10 15:14
 */
public class NotifyUtils {

    public static void showNotify(Context context){
        NotificationManager notifyManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        //实例化NotificationCompat.Builde并设置相关属性
        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, context.getPackageName())
                //设置小图标
                .setSmallIcon(R.mipmap.app_icon)
                //设置通知标题
                .setContentTitle("极速时时彩")
                //设置通知内容
                .setContentText("开奖结束")
                .setAutoCancel(true)
                .setDefaults(Notification.DEFAULT_SOUND);
        //设置通知时间，默认为系统发出通知的时间，通常不用设置
        //.setWhen(System.currentTimeMillis());
        //通过builder.build()方法生成Notification对象,并发送通知,id=1
        notifyManager.notify(R.mipmap.app_icon, builder.build());
//        String url = "mqqwpa://im/chat?chat_type=wpa&uin=497225521&Message=测试";
//        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    }
}
